package com.example.appjava.dao;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Size;

/**
 * @author sjw
 * @className User
 * @date 2021/6/29 8:47
 * @description: TODO
 */
@Entity
@Table(name = "user1")
public class User {
    @Id
    @GenericGenerator(name = "autoId",strategy = "native")
    @GeneratedValue(generator = "autoId")
    private Integer id;

    @Size(max = 5)
    private String name;
    @Max(50)
    private Integer age;

    private Integer tenantId=3;

    public User(){

    }

    public User(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public User(Integer id,String name, Integer age){
        this.id=id;
        this.name=name;
        this.age=age;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
